<script src="./js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="./js/jquery.validate.js" type="text/javascript"></script>
<script src="./js/jquery.metadata.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
/*
$().ready(function() {
	 $("#signupForm").validate();
	});
*/

$().ready(function() {
	 $("#signupForm").validate({
	        rules: {
	   firstname: "required",
	   email: {
	    required: true,
	    email: true
	   },
	   password: {
	    required: true,
	    minlength: 5
	   },
	   confirm_password: {
	    required: true,
	    minlength: 5,
	    equalTo: "#password"
	   },
	   
	   remote_input: {
		   required:true,
		   minlength: 5,
		   remote:{
			   url: "/jquery/json/bb?validate=validate",     //后台处理程序 
			   type: "POST",               //数据发送方式
			   dataType: "json",           //接受数据格式    
			   data: {                     //要传递的数据
			    enName: function() {
			    	return $("#remote_input").val();
			    }
			   },
			   success: function(dt) {
				   if (dt.result) {
					   alert("kitty");   
				   } else {
					   alert("cccc");
				   }
			   }
		   
	   }
	  }
	        },
	        messages: {
	   firstname: "请输入姓名",
	   email: {
	    required: "请输入Email地址",
	    email: "请输入正确的email地址"
	   },
	   password: {
	    required: "请输入密码",
	    minlength: jQuery.format("密码不能小于{0}个字 符")
	   },
	   confirm_password: {
	    required: "请输入确认密码",
	    minlength: "确认密码不能小于5个字符",
	    equalTo: "两次输入密码不一致不一致"
	   },
	   remote_input: {
		   minlength: "不足5个字符."
	   }
	  
	  }
	    });
	});



//-->
</script>

<form id="signupForm" method="get" action="">
    <p>
        <label for="firstname">Firstname</label>
        <input id="firstname" name="firstname"  />
    </p>
 <p>
  <label for="email">E-Mail</label>
  <input id="email" name="email"   />
 </p>
 <p>
  <label for="password">Password</label>
  <input id="password" name="password" type="password"  />
 </p>
 <p>
  <label for="confirm_password">确认密码</label>
  <input id="confirm_password" name="confirm_password" type="password"  />
 </p>
 <p>
  <label for="remote_input">远程验证</label>
  <input id="remote_input" name="remote_input" type="text"  />
 	
 </p>
    <p>
        <input class="submit" type="submit" value="Submit"/>
    </p>
</form>


<!-- 
<form id="signupForm" method="get" action="">
    <p>
        <label for="firstname">Firstname</label>
        <input id="firstname" name="firstname" class="{required:true,minlength:5,messages:{required:'请输入内容',minlength:'最小五个字符!'}}" />
    </p>
 <p>
  <label for="email">E-Mail</label>
  <input id="email" name="email" class="required email" />
 </p>
 <p>
  <label for="password">Password</label>
  <input id="password" name="password" type="password" class="{required:true,minlength:5}" />
 </p>
 <p>
  <label for="confirm_password">确认密码</label>
  <input id="confirm_password" name="confirm_password" type="password" class="{required:true,minlength:5,equalTo:'#password'}" />
 </p>
    <p>
        <input class="submit" type="submit" value="Submit"/>
    </p>
</form>
 -->